const Koa = require('koa');
const axios = require('axios');
const parser = require('koa-bodyparser');

const InitManager = require('./core/init');
const catchError = require('./middlewares/exception');

const app = new Koa();
app.use(catchError);
app.use(parser());


InitManager.initCore(app);
// app.use(router.routes());

/*app.use(async (ctx, next) => {
  if (ctx.path === '/classic/latest' && ctx .method === 'GET') {
    ctx.body = { key: "class" }
  }
  next()
});*/

// 终极异步解决方案： async
app.use(async (ctx, next) => {
  next();
  console.log('=====')
});

app.listen(3000);